package cn.zh.planmanager.api.facade;

import cn.zh.planmanager.api.convert.PlanDTOConvert;
import cn.zh.planmanager.api.dto.PlanDTO;
import cn.zh.planmanager.application.bo.PlanBO;
import cn.zh.planmanager.application.service.PlanApplicationService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zh
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/plan")
public class PlanFacade {

    private final PlanApplicationService planApplicationService;

    @GetMapping("/{id}")
    public PlanDTO getOne(@PathVariable Long id){
        PlanBO bo = planApplicationService.findById(id);
        return PlanDTOConvert.convertToDTO(bo);
    }
}
